
"""
函数
"""


# 关键字传参
def get_age(name, age):
    # print('{0} {1} 岁了'.format(name, age), end='\n')
    print(f'{name} {age} 岁了', end='\n')


get_age(age=10, name='小明')


"""
可变参数
"""


def fun(*param):
    print(type(param))
    for v in param:
        print('v = ', v, end='\n')


fun(10, 20, 30)
fun()
# 元组类型：v = [11, 22, 33]
fun([11, 22, 33])
# 将列表进行解包
fun(*[44, 55, 66])


"""
个数可变的关键字参数
"""


def fun2(**kwargs):
    for k, v in kwargs.items():
        print(f'{k} => {v}', end='\n')


fun2(name="张三", age=20)
# 传递 map
m = {'name': '李四', 'age': 30}
fun2(**m)

